package com.es.controller;
import com.es.bean.Student;
import com.es.bean.Teacher;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;

/**
 * 描述:
 * es-meta-
 *
 * @author Derek
 * @create 2021-11-26 11:16
 */
@Controller
@RequestMapping("/params")
public class ParamController {

    @RequestMapping("/index")
    public String manage(){
        return "params";
    }

    @RequestMapping("/simpleParams")
    public String simpleParams(String username,Integer age){
        System.out.println("username："+username);
        System.out.println("age:"+age);
        return "params";
    }

    @RequestMapping("/arrayParams")
    public String arrayParams(String[] likes){
        if(likes!=null){
            System.out.println(String.join("\n",likes));
        }
        return "params";
    }

    @RequestMapping("/listParams")
    public String listParams(ArrayList<String> likes){
        System.out.println(likes.size());
        likes.forEach(System.out::println);
        return "params";
    }

    @RequestMapping("/pojoParams")
    public String pojoParams(Student student){
        System.out.println(student);
        return "params";
    }


    @RequestMapping("/teaParams")
    public String teaParams(Teacher teacher){
        System.out.println(teacher);
        return "params";
    }


}
